// index.js
// 获取应用实例
const App = getApp()
const api = require('../../utils/requst.js').API;
Page({
  data: {
    top:0,
    latitude: 23.096994,
    longitude: 113.324520,
    markers: [],
    info:{}
  },
  onLoad(e) {
    let top =App.globalData.systemInfo.statusBarHeight + App.globalData.menuButton.height + (App.globalData.menuButton.top - App.globalData.systemInfo.statusBarHeight)*2
    console.log(top)
    this.setData({top:top,latitude:e.latitude,longitude:e.longitude})
    api.getPageHotelBuildingList({id:e.id}).then(res=>{
      var list = res.data.data.records[0]
      this.setData({info:list})
    })
  },
  onReady: function (e) {
    this.mapCtx = wx.createMapContext('myMap')
    this.setData({
      markers:[ {
        id: 1,
        latitude: 23.096994,
        longitude: 113.324520,
        iconPath: '../../assets/images/location.png',
        callout: {
          content: '香格里拉大酒店',
          color: '#666666',
          fontSize: 14,
          borderWidth: 1,
          borderRadius: 20,
          borderColor: '#dddddd',
          bgColor: '#fff',
          padding: 5,
          display: 'ALWAYS',
          textAlign: 'center'
        }
      }],
      customCalloutMarkerIds: [2,3,4],
    })
  },
  markertap(e) {
    console.log(e)
    wx.openLocation({
      latitude: 23.096994,
      longitude: 113.324520,
      scale: 14
    })
  },
})
